package com.definity.toolkit.web.taglib;

import javax.servlet.jsp.JspException;

import com.definity.toolkit.i18n.I18nFactory;

public class I18nTag extends BaseTag {

	private static final long serialVersionUID = -4395330249112652046L;

	private String key;
	private String base;
	
	public I18nTag() {
		setBase("application");
	}
	
	public void setKey(String key) {
		this.key = key;
	}
	
	public void setBase(String i18n) {
		this.base = i18n;
	}
	
	@Override
	public int doEndTag() throws JspException {
		write(I18nFactory.create(base).tl(key));
		return EVAL_PAGE;
	}
	
}
